<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <cpn1></cpn1>
        <cpn2></cpn2>
    </div>
    <script src='../js/vue.js'></script>

    <script>
        //1.注册组件的全局写法
        Vue.component('cpn1', {
            template: `
              <div>
                <h2>我是标题1</h2>
                <p>我是p</p>
                <span>我是span</span>
              </div>
            `
        })

        const app = new Vue({
            el: '#app',
            components: {
                //2.注册组件的局部写法
                cpn2: {
                    template: `
                      <div>
                        <h2>我是标题2</h2>
                        <p>我是p</p>
                        <span>我是span</span>
                      </div>
                    `
                }
            }
        })
    </script>
</body>

</html>